<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<div class="modal-dialog x-modal-dialog" style="width: 650px; margin-top: 100px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-fire" title="过滤查询"></i>&nbsp;&nbsp;<span>代言人列表&nbsp;-&nbsp;添加代言人</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>
    
    <form class="form-horizontal" method="POST" action="${ctx.host}/agents" data-validate="true">

      <div class="modal-body">

        <div class="form-group x-form-group">
          <label class="col-xs-4 control-label">用户电话</label>
          <div class="col-xs-6 pull-left">
              <input type="text" class="form-control" name="mobile" value="" data-validate="required|mobile" placeholder="请输入用户手机号"/>
              <a class="btn user-search" style="position:absolute;top:0;left:306px;">查询</a>
              <input type="hidden" name="user.id" value="" />
              <input type="hidden" name="name" value="" />
          </div>
        </div>
        
        <div class="form-group x-form-group search-block" style="display:none">
          <label class="col-xs-4 control-label">查询结果</label>
          <div class="col-xs-6 pull-left">
              <p class="form-control-static search-result"></p>
          </div>
        </div>
        
        <div class="form-group x-form-group">
          <label class="col-xs-4 control-label">折扣方式</label>
          <div class="col-xs-6 pull-left">
             <select name="discountType" class="select2 form-control" data-validate="required">
              <option value=""></option>
              <c:forEach var="discountType" items="${enums['discountType']}">
                <option value="${discountType.alias}">${discountType.description}</option>
              </c:forEach>
            </select>
          </div>
        </div>
        
        <div class="form-group x-form-group discount-type" style="display:none;">
          <label class="col-xs-4 control-label">折扣金额</label>
          <div class="col-xs-6 pull-left">
            <input type="text" class="form-control" name="discountOffer" value="" data-validate="required|discount_validate" placeholder="可输入多个，金额之间以逗号隔开"/>
          </div>
        </div>
        
        <div class="form-group x-form-group discount-type" style="display:none;">
          <label class="col-xs-4 control-label">奖励金额</label>
          <div class="col-xs-6 pull-left">
            <input type="text" class="form-control" name="commission" value="" data-validate="required|discount_validate" placeholder="可输入多个，金额之间以逗号隔开"/>
          </div>
        </div>
        
        <div class="form-group x-form-group payment-type" style="display:none;">
          <label class="col-xs-4 control-label">代言人折扣</label>
          <div class="col-xs-6 pull-left">
            <div class="input-group">
              <input type="text" class="form-control" name="agentDiscount" value="" data-validate="required|number|percentage_validate" placeholder="请输入代言人折扣"/>
              <div class="input-group-addon">%</div>
            </div>
          </div>
        </div>
        
        <div class="form-group x-form-group payment-type" style="display:none;">
          <label class="col-xs-4 control-label">用户折扣</label>
          <div class="col-xs-6 pull-left">
            <div class="input-group">
              <input type="text" class="form-control" name="userDiscount" value="" data-validate="required|discount_validate|percentage_validate" placeholder="可输入多个，折扣之间以逗号隔开" />
              <div class="input-group-addon">%</div>
            </div>
          </div>
        </div>
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn disabled">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>
  

</div>

<script type="text/javascript">
  $(function() {
    
    $('select[name="discountType"]').select2({
      placeholder : '请选择折扣方式',
      minimumResultsForSearch : -1,
      allowClear : true,
      width: '100%'
     });
    
  })
</script>